

//捉去6张图片作对象
var me_img = document.getElementsByClassName('me_img');
var click_button = document.getElementsByClassName('click_button');

//捉去背景图片
var banner = document.getElementById('banner');

//捉取可以点击的点
var img = document.getElementById('img');

//捉取可以点击的点
var color =['#E7FAFF' , '#FFFFFF' , '#121212' , '#E0E7F9' , '#E4E4E4' , '#EBEBEB'];

var num = 0;

function run () {
	for (var i =0 ; i<me_img.length;i++) {
		me_img[i].style.display="none";
		click_button[i].style.backgroundColor="rgba(0,0,0,0)";
	};

	me_img[num].style.display = "block";
	banner.style.backgroundColor = color[num];
	click_button[num].style.backgroundColor="#00c3f5";

	if(num == me_img.length-1){
		num=0;
	}else{
		num++;
	}
}


run();
//设置定时器
var time = setInterval(run,1000);


//进去停了定时器
img.onmousemove = function (argument) {
	clearInterval(time);
}

//出去恢复定时器
img.onmouseout = function (argument) {
	time = setInterval(run,1000);
}


for(var i =0; i<click_button.lenght; i++) {
	click_button[i].onmouseover = function () {
		this.style.backgroundColor="rgba(0,195,245,1)";
	}

	click_button[i].onmouseout = function() {
		this.style.backgroundColor="rgba(0,195,245,0)";
	}

	buttonclick(i);
};

function buttonclick (i) {
	click_button[i].onclick = function () {
		num = i;
		run();
	}
}
